package com.xingu.xg.config;

import com.xingu.xg.common.consts.ComCodeMsg;
import com.xingu.xg.common.consts.ComRT;
import com.xingu.xg.common.consts.ComResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @param
 * @BelongsProject: xg-interview-java
 * @BelongsPackage: com.xingu.xg.common.config
 * @author: L
 * @Date: 2024/5/21 0:24
 * @return
 */
@ControllerAdvice
public class ExceptionHandlerConfig {
    @ExceptionHandler
    public ComResult runtimeException(RuntimeException e){
        return ComRT.fail(ComCodeMsg.BUSINESS_ERROR, e.getMessage());
        // return ComRT.fail(ComCodeMsg.BUSINESS_ERROR, ComCodeMsg.BUSINESS_ERROR_MSG);
    }
}
